function tokenInterceptor(app) {
  //拦截token在请求头中使用字段Authorization声明
app.use('*',function(request,response,next){
    //请求路径名称
    let pathname = request._parsedUrl.pathname
    //如果是登录注册，不需要拦截token
    if(pathname==='/login'||pathname ==="/register"){
      return next()
    }
    let headers = request.headers
    let token = headers.Authorization
    //没有携带token，让用户进行登录，获取token
    if(!token){
      return response.send('请先登录')
    }
    let jwt = new Jwt(token)
    if(jwt.verifyToken()==='err'){
      return response.send('请重新登录')
    }
    next()
  })  
  }

  exports.tokenInterceptor = tokenInterceptor